<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
	.table-striped {width:100%;margin-top: 10px;}
	.table-striped th{background:#999;color:#FFF;padding:5px}
	.table-striped tbody td,.table-striped tfoot td{background:#F2F2F2;text-align:center;padding:5px}
	.info_basic{padding:10px;}
</style>
<p style="background:#4cc343;color:#FFF;padding:5px"> Chi tiết đơn hàng </p>
<div class="info_basic">
	<?php echo lang('order_number')?>: <?php echo $order_id ?>
    <br />
    <?php
    if($customer['company'] != ''){
        echo '<strong>Tên công ty: </strong>'.$customer['company'].'<br />';
    }
    ?>
    Thông tin cơ bản:
    <?php echo $customer['fullname'];?> |
    <?php echo $customer['email'];?> |
    <?php echo $customer['phone'];?>
    <br />
    <span><?php echo lang('payment_information');?>:</span> <?php echo $payment['description']; ?>
  
    <table style="width:100%;margin-top:10px;" style=" line-height:150%">
   		<tr style="background:#999;color:#FFF">
        	<td style="width:70%;padding:5px"> Địa chỉ giao hàng</td>
        </tr>
        <tr>
        	<td>
            	<?php $ship = $customer['ship_address'];?>
                <?php  if(!empty($ship['company'])) echo "<strong>Tên công ty:</strong> ".$ship['company'].'<br>';?>	
                <?php  if(!empty($ship['fullname'])) echo "<strong>Họ và tên:</strong> ".$ship['fullname'].'<br>';?>	
                <?php  if(!empty($ship['phone'])) echo "<strong>Số điện thoại:</strong> ".$ship['phone'].'<br>';?>	
                <?php  if(!empty($ship['address1'])) echo "<strong>Địa chỉ 1:</strong> ".$ship['address1'].'<br>';?>	
                <?php  if(!empty($ship['zone'])) echo "<strong>Tỉnh/TP:</strong> ".$ship['zone'].'<br>';?>
                <?php  if(!empty($ship['area'])) echo "<strong>Khu vực:</strong> ".$ship['area'].'<br>';?>
            </td>
        </tr>
    </table>
    <br/>
   <?php if(!empty($note)){?>
    <table style="width:100%;margin-top:10px; line-height:150%">
   		<tr style="background:#999;color:#FFF">
        	<td style="width:70%;padding:5px"> Ghi chú thêm </td>
        </tr>
        <tr>
        	<td>
            	<?php echo $note ?>
            </td>
        </tr>
    </table>
    <br/>
    <?php }?>
    <p><b>Danh mục sản phẩm đã mua </b></p>
	<table class="table table-striped table-bordered" border="1" style="line-height:150%">
		<thead>
			<tr>
				<th style="width:10%;"><?php echo lang('sku');?></th>
				<th style="width:20%;"><?php echo lang('name');?></th>
				<th style="width:10%;"><?php echo lang('price');?></th>
				<th style="width:10%;"><?php echo lang('quantity');?></th>
				<th style="width:8%;"><?php echo lang('totals');?></th>
			</tr>
		</thead>
		
		<tfoot>
			<?php
			/**************************************************************
			Subtotal Calculations
			**************************************************************/
			?>
			<?php if($this->go_cart->group_discount() > 0)  : ?> 
        	<tr>
				<td colspan="4"><strong><?php echo lang('group_discount');?></strong></td>
				<td>-<?php echo format_currency($this->go_cart->group_discount()); ?></td>
			</tr>
			<?php endif; ?>
			<tr>
		    	<td colspan="4"><strong><?php echo lang('subtotal');?></strong></td>
				<td id="gc_subtotal_price"><?php echo format_currency($this->go_cart->subtotal()); ?></td>
			</tr>
			<?php if($this->go_cart->coupon_discount() > 0) {?>
		    <tr>
		    	<td colspan="4"><strong><?php echo lang('coupon_discount');?></strong></td>
				<td id="gc_coupon_discount">-<?php echo format_currency($this->go_cart->coupon_discount());?></td>
			</tr>
				<?php if($this->go_cart->order_tax() != 0) { // Only show a discount subtotal if we still have taxes to add (to show what the tax is calculated from)?> 
				<tr>
		    		<td colspan="4"><strong><?php echo lang('discounted_subtotal');?></strong></td>
					<td id="gc_coupon_discount"><?php echo format_currency($this->go_cart->discounted_subtotal());?></td>
				</tr>
				<?php
				}
			} 
			/**************************************************************
			 Custom charges
			**************************************************************/
			$charges = $this->go_cart->get_custom_charges();
			if(!empty($charges))
			{
				foreach($charges as $name=>$price) : ?>
					
			<tr>
				<td colspan="4"><strong><?php echo $name?></strong></td>
				<td><?php echo format_currency($price); ?></td>
			</tr>	
					
			<?php endforeach;
			}	
			
			/**************************************************************
			Order Taxes
			**************************************************************/
			 // Show shipping cost if added before taxes
			if($this->config->item('tax_shipping') && $this->go_cart->shipping_cost()>0) : ?>
				<tr>
				<td colspan="4"><strong><?php echo lang('shipping');?></strong></td>
				<td><?php echo format_currency($this->go_cart->shipping_cost()); ?></td>
			</tr>
			<?php endif; ?>
			<?php if($this->go_cart->order_tax() > 0) :  ?>
		    <tr>
		    	<td colspan="4"><strong><?php echo lang('tax');?></strong></td>
				<td><?php echo format_currency($this->go_cart->order_tax());?></td>
			</tr>
			<?php endif; ?>
			<?php // Show shipping cost if added after taxes
			if(!$this->config->item('tax_shipping') && $this->go_cart->shipping_cost()>0) : ?>
				<tr>
				<td colspan="4"><strong><?php echo lang('shipping');?></strong></td>
				<td><?php echo format_currency($this->go_cart->shipping_cost()); ?></td>
			</tr>
			<?php endif ?>
			
			<?php
			/**************************************************************
			Gift Cards
			**************************************************************/
			if($this->go_cart->gift_card_discount() > 0) : ?>
                <tr>
                    <td colspan="4"><strong><?php echo lang('gift_card_discount');?></strong></td>
                    <td>-<?php echo format_currency($this->go_cart->gift_card_discount()); ?></td>
                </tr>
			<?php endif; ?>
           <?php
			/**************************************************************
			Score
			**************************************************************/
			if($this->go_cart->total_score_minus_discount() != 0):?>
                <tr>
                    <td colspan="4"><strong>Số điểm bị trừ <?php echo $this->go_cart->total_score_minus_discount() ?> điểm, qui đổi ra tiền  </strong></td>
                    <td>-<?php echo format_currency($this->go_cart->total_price_score()); ?></td>
                </tr>
			<?php endif; ?>
              <?php if(!empty($shipping_location)){?>
                    <tr>
                        <td colspan="4"><strong>Phí vận chuyển (<?php echo !empty($order_weight)?$order_weight:(0)?>g)</strong></td>
                        <td> <?php echo format_currency($shipping_location["total_price_shipping"]); ?></td>
                    </tr>
			<?php }?>
			<?php
			/**************************************************************
			Grand Total
			**************************************************************/
			?>
            
			<tr>
				<td colspan="4"><strong><?php echo lang('grand_total');?></strong></td>
				<td><?php echo format_currency($this->go_cart->total()); ?></td>
			</tr>
		</tfoot>
		<tbody>
			<?php
			$subtotal = 0;
			foreach ($this->go_cart->contents() as $cartkey=>$product):?>
				<tr>
					<td><?php echo $product['sku']; ?></td>
					<td><?php echo $product['name']; ?></td>
					<td><?php echo format_currency($product['price']);?></td>
					
					<td style="white-space:nowrap">
						<?php if($this->uri->segment(1) == 'cart'): ?>
							<?php if(!(bool)$product['fixed_quantity']):?>
                                <div class="control-group">
                                    <div class="controls">
                                        <div class="input-append">
                                            <input class="span1" style="margin:0px;" name="cartkey[<?php echo $cartkey;?>]"  value="<?php echo $product['quantity'] ?>" size="3" type="text"><button style="line-height: 12px;margin-top: -3px;"  class="btn btn-danger" type="button" onclick="if(confirm('<?php echo lang('remove_item');?>')){window.location='<?php echo site_url('cart/remove_item/'.$cartkey);?>';}"> <span class="">X</span></button>
                                        </div>
                                    </div>
                                </div>
							<?php else:?>
								<?php echo $product['quantity'] ?>
								<input type="hidden" name="cartkey[<?php echo $cartkey;?>]" value="1"/>
								<button class="btn btn-danger" type="button" onclick="if(confirm('<?php echo lang('remove_item');?>')){window.location='<?php echo site_url('cart/remove_item/'.$cartkey);?>';}"><i class="icon-remove icon-white"></i></button>
							<?php endif;?>
						<?php else: ?>
							<?php echo $product['quantity'] ?>
						<?php endif;?>
					</td>
					<td><?php echo format_currency($product['price']*$product['quantity']); ?></td>
				</tr>
			<?php endforeach;?>
		</tbody>
	</table>
</div>